package demo1;

//牛客网:小红的口罩
import java.util.*;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        int[] a = new int[n];
        PriorityQueue<Integer> q = new PriorityQueue<>();
        for(int i = 0; i<n; i++) {
            a[i] = in.nextInt();
            q.add(a[i]);
        }

        int s = 0;
        int ret = 0;
        while(s < k) {
            int x = q.poll();
            s += x;
            q.add(x*2);
            ret ++;
        }
        System.out.println(ret-1);
    }
}